// 工具函数
/**
 * 获取点击事件传参
 * @param {object} event 点击拿到的event对象
 * @param {string} key 需要获取的参数名
 * @returns
 */
const getConditionParams = (event, key) => {
	const params = event.currentTarget.dataset;
	return params[key];
};
/**
 * 显示提示框
 * @param {string} title
 * @param {number} duration
 * @param {string} icon
 */
const showToast = (title, duration = 800, icon = 'none') => {
	wx.showToast({
		title,
		duration,
		icon,
	});
};
/**
 * 显示模态对话框
 * @param {string} title
 * @param {string} content
 * @param {string} cancelColor
 * @param {string} confirmColor
 */
const showModal = (title, content, cancelColor, confirmColor = '#1cccdf') => {
	wx.showModal({
		title,
		content,
		cancelColor,
		confirmColor,
		success(res) {
			return res;
		},
	});
};
export { getConditionParams, showToast, showModal };
